home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / tlp4v11c / source / hello.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-05-15  |  1.3 KB  |  46 lines

  1. #include <conio.h>    /* for getch() */
  2. #include <stdio.h>      /* for standard I/O */
  3.  
  4. #include "tgdlp4.h"     /* don't forget to include tgdlp4sc.obj in your project */
  5. #include "tgdsupp.h"    /* don't forget to include tgdsuppc.obj in your project */
  6.  
  7. #define ERR_NO 0
  8. #define ERR_BADVGA 1
  9.  
  10. main()
  11. { ubyte colors[]={ 0,0,0, 48,48,48, 0,0,48, 48,0,0 };
  12.   word polygon1[]={ 0,256, 255,256, 128,383 };
  13.   word polygon2[]={ 0,511, 255,511, 128,384 };
  14.  
  15.   /* initialize graphics driver */
  16.   if (vgalp4()) { printf("?No VGA card or VGA card with less than 256KB installed\n"); return(ERR_BADVGA); };
  17.  
  18.   /* set new screenmode (why not 256x256?) */
  19.   waittof(); screenmode(SM_256x256);
  20.  
  21.   /* set the colors after a waittof() to prevent snow on the screen */
  22.   waittof(); rgb6(0,3,colors);
  23.  
  24.   /* clear the screen using color 2: 0,0,48 = blue */
  25.   pen(PEN_B,2); clearreg();
  26.  
  27.   /* displayed area is (0,256)-(255,511) of the virtual screen
  28.    * draw two polygons in it.
  29.    */
  30.   pen(PEN_F,3); drawpoly(3,polygon1); drawpoly(3,polygon2);
  31.  
  32.   /* finally, print some text */
  33.   /* BM_SOLID prints the text with bg color 0, fg color 1 */
  34.   bltmode(BM_SOLID);
  35.   txtcrsr(0,504);
  36.   prttext("Hello world... Press a key!     ");
  37.  
  38.   /* wait for a key */
  39.   if (!getch()) getch();
  40.  
  41.   /* switch back to text mode */
  42.   co80();
  43.  
  44.   return(ERR_NO);
  45. }
  46.